package com.renrenyou.duanshipin.home;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.renrenyou.duanshipin.R;
import com.renrenyou.duanshipin.base.BaseFragment;
import com.renrenyou.duanshipin.databinding.FragmentUtilBinding;
import com.renrenyou.duanshipin.tools.Md5Activity;
import com.renrenyou.duanshipin.tools.PicZipActivity;
import com.renrenyou.duanshipin.tools.VideoZipActivity;
import com.renrenyou.duanshipin.tools.WeijinActivity;
import com.renrenyou.duanshipin.util.ActivityUtil;
import com.renrenyou.duanshipin.util.ToastUtil;

public class UtilFragment extends BaseFragment<FragmentUtilBinding> implements View.OnClickListener {
    @Override
    public FragmentUtilBinding getBinding(LayoutInflater inflater) {
        return FragmentUtilBinding.inflate(inflater);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        Glide.with(this).load(R.mipmap.ic_material_bg).into(mBinding.ivUtilBg);

        mBinding.ivUtilMd5.setOnClickListener(this);
        mBinding.ivUtilWeijin.setOnClickListener(this);
        mBinding.ivUtilOriginCreate.setOnClickListener(this);
        mBinding.ivUtilXianliu.setOnClickListener(this);
        mBinding.ivUtilVideoZip.setOnClickListener(this);
        mBinding.ivUtilPicZip.setOnClickListener(this);
        mBinding.ivUtilVideoWater.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.iv_util_md5) {
            ActivityUtil.startActivity(getContext(), Md5Activity.class);
        } else if (view.getId() == R.id.iv_util_weijin) {
            ActivityUtil.startActivity(getContext(), WeijinActivity.class);
        } else if (view.getId() == R.id.iv_util_origin_create) {
            ToastUtil.showToast(getContext(), "暂未开放");
        } else if (view.getId() == R.id.iv_util_xianliu) {
            ToastUtil.showToast(getContext(), "暂未开放");
//            ActivityUtil.startActivity(getContext(), XianliuActivity.class);
        } else if (view.getId() == R.id.iv_util_video_zip) {
            ActivityUtil.startActivity(getContext(), VideoZipActivity.class);
        } else if (view.getId() == R.id.iv_util_pic_zip) {
            ActivityUtil.startActivity(getContext(), PicZipActivity.class);
        } else if (view.getId() == R.id.iv_util_video_water) {
            ToastUtil.showToast(getContext(), "暂未开放");
        }
    }
}
